<?php
App::uses('AppController', 'Controller');
class LoginController extends  Controller {
     function index(){
         $this->layout = 'login';
     }
    function login(){
		//session_start();
		$this->layout = 'login';
                if($this->Login->validates()){
               
                    $this->Session->write('perfilId', 'admin');
                    $this->Session->write('usuario', 'Ivaldo');
                    $this->redirect('/', false);
                    $this->Session->setFlash("Efetue o login. Valido");
                }else{
//                    $this->redirect('/login', false);
                    $this->Session->setFlash("Efetue o login. Invalido");
                }
    }
    
    function sair(){
        $this->Session->delete('perfilId', 'admin');
        $this->Session->delete('usuario', 'Ivaldo');
        $this->redirect('/siscel/login', false);
    }
}
?>
